import { ActionTypes } from '../constants'
const initialState = {
    videoList: [],
    petVideoList: [],
    userVideoList: []
}

export default function videoList(state = initialState, { type, payload }) {
    switch(type) {
        case ActionTypes.API_GET_VIDEO_LIST_SUCCESS:
            return {
                ...state,
                videoList: payload
            }
        case ActionTypes.API_GET_PET_VIDEO_BY_PET_ID_SUCCESS:
            return {
                ...state,
                petVideoList: payload
            }
        case ActionTypes.API_GET_USER_VIDEO_LIST_BY_USER_SUCCESS:
            return {
                ...state,
                userVideoList: payload.works || []
            }
    }
    return state
}